package compositeMod;

import compositeMod.code.Group;
import compositeMod.code.Member;

public class Client {
    public static void main(String[] args) {
        // 创建成员
        code code = new code();
        Member alice = code.new Member("Alice");
        Member bob = code.new Member("Bob");

        // 创建组并添加成员
        Group friends = code.new Group("Friends");
        friends.add(alice);
        friends.add(bob);

        // 创建另一个组并添加成员
        Group family = code.new Group("Family");
        family.add(alice); // Alice 同时在两个组中

        // 测试分享消息
        System.out.println("Alice shares a message with Friends:");
        alice.share("Hello, Friends!");

        System.out.println("\nBob shares a message with Friends:");
        bob.share("Hello, Friends!");

        System.out.println("\nFamily shares a message:");
        family.share("Hello, Family!");

        System.out.println("\nFriends shares a message:");
        friends.share("Hello, Friends!");
    }
}
